home *** CD-ROM | disk | FTP | other *** search
/ Resource for Source: C/C++ / Resource for Source - C-C++.iso / misc_src / sqlsomdb / sample10 / mainform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-01  |  22.0 KB  |  658 lines

  1. VERSION 2.00
  2. Begin Form Mainform 
  3.    BackColor       =   &H00FFFFC0&
  4.    Caption         =   "Test SQL-Sombrero VBX - Author Application"
  5.    ClientHeight    =   4725
  6.    ClientLeft      =   1365
  7.    ClientTop       =   525
  8.    ClientWidth     =   7680
  9.    Height          =   5130
  10.    Left            =   1305
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4725
  13.    ScaleWidth      =   7680
  14.    Top             =   180
  15.    Width           =   7800
  16.    Begin DEMVBXDB SQLVBXDB1 
  17.       Left            =   2820
  18.       Top             =   4020
  19.    End
  20.    Begin ComboBox author_list 
  21.       FontBold        =   -1  'True
  22.       FontItalic      =   0   'False
  23.       FontName        =   "Fixedsys"
  24.       FontSize        =   9
  25.       FontStrikethru  =   0   'False
  26.       FontUnderline   =   0   'False
  27.       Height          =   330
  28.       Left            =   240
  29.       Style           =   2  'Dropdown List
  30.       TabIndex        =   25
  31.       Top             =   120
  32.       Width           =   7095
  33.    End
  34.    Begin CommandButton delbut 
  35.       Caption         =   "Delete Author"
  36.       Height          =   615
  37.       Left            =   6000
  38.       TabIndex        =   24
  39.       Top             =   2040
  40.       Visible         =   0   'False
  41.       Width           =   1335
  42.    End
  43.    Begin CommandButton cancelbut 
  44.       Caption         =   "Cancel"
  45.       Height          =   495
  46.       Left            =   6240
  47.       TabIndex        =   23
  48.       Top             =   3840
  49.       Visible         =   0   'False
  50.       Width           =   855
  51.    End
  52.    Begin CommandButton newrec 
  53.       Caption         =   "Add New"
  54.       Height          =   615
  55.       Left            =   6000
  56.       TabIndex        =   22
  57.       Top             =   1320
  58.       Visible         =   0   'False
  59.       Width           =   1335
  60.    End
  61.    Begin CommandButton updbut 
  62.       Caption         =   "Update Info"
  63.       Height          =   615
  64.       Left            =   6000
  65.       TabIndex        =   21
  66.       Top             =   3120
  67.       Visible         =   0   'False
  68.       Width           =   1335
  69.    End
  70.    Begin CommandButton chgbut 
  71.       Caption         =   "Change Info"
  72.       Height          =   615
  73.       Left            =   6000
  74.       TabIndex        =   20
  75.       Top             =   600
  76.       Visible         =   0   'False
  77.       Width           =   1335
  78.    End
  79.    Begin TextBox Text1 
  80.       Enabled         =   0   'False
  81.       Height          =   285
  82.       Index           =   8
  83.       Left            =   1560
  84.       MaxLength       =   10
  85.       TabIndex        =   19
  86.       Top             =   3480
  87.       Visible         =   0   'False
  88.       Width           =   3855
  89.    End
  90.    Begin TextBox Text1 
  91.       Enabled         =   0   'False
  92.       Height          =   285
  93.       Index           =   7
  94.       Left            =   1560
  95.       MaxLength       =   12
  96.       TabIndex        =   18
  97.       Top             =   3120
  98.       Visible         =   0   'False
  99.       Width           =   3855
  100.    End
  101.    Begin TextBox Text1 
  102.       Enabled         =   0   'False
  103.       Height          =   285
  104.       Index           =   6
  105.       Left            =   1560
  106.       MaxLength       =   2
  107.       TabIndex        =   17
  108.       Top             =   2760
  109.       Visible         =   0   'False
  110.       Width           =   3855
  111.    End
  112.    Begin TextBox Text1 
  113.       Enabled         =   0   'False
  114.       Height          =   285
  115.       Index           =   5
  116.       Left            =   1560
  117.       MaxLength       =   20
  118.       TabIndex        =   16
  119.       Top             =   2400
  120.       Visible         =   0   'False
  121.       Width           =   3855
  122.    End
  123.    Begin TextBox Text1 
  124.       Enabled         =   0   'False
  125.       Height          =   285
  126.       Index           =   4
  127.       Left            =   1560
  128.       MaxLength       =   40
  129.       TabIndex        =   15
  130.       Top             =   2040
  131.       Visible         =   0   'False
  132.       Width           =   3855
  133.    End
  134.    Begin TextBox Text1 
  135.       Enabled         =   0   'False
  136.       Height          =   285
  137.       Index           =   3
  138.       Left            =   1560
  139.       MaxLength       =   12
  140.       TabIndex        =   14
  141.       Top             =   1680
  142.       Visible         =   0   'False
  143.       Width           =   3855
  144.    End
  145.    Begin TextBox Text1 
  146.       Enabled         =   0   'False
  147.       Height          =   285
  148.       Index           =   2
  149.       Left            =   1560
  150.       MaxLength       =   20
  151.       TabIndex        =   13
  152.       Top             =   1320
  153.       Visible         =   0   'False
  154.       Width           =   3855
  155.    End
  156.    Begin TextBox Text1 
  157.       Enabled         =   0   'False
  158.       Height          =   285
  159.       Index           =   1
  160.       Left            =   1560
  161.       MaxLength       =   40
  162.       TabIndex        =   12
  163.       Top             =   960
  164.       Visible         =   0   'False
  165.       Width           =   3855
  166.    End
  167.    Begin TextBox Text1 
  168.       Enabled         =   0   'False
  169.       Height          =   285
  170.       Index           =   0
  171.       Left            =   1560
  172.       MaxLength       =   11
  173.       TabIndex        =   11
  174.       Top             =   600
  175.       Visible         =   0   'False
  176.       Width           =   3855
  177.    End
  178.    Begin CommandButton exitbut 
  179.       Caption         =   "Exit"
  180.       Height          =   375
  181.       Left            =   4200
  182.       TabIndex        =   1
  183.       Top             =   3960
  184.       Width           =   1095
  185.    End
  186.    Begin CommandButton multibut 
  187.       Caption         =   "Logon"
  188.       Height          =   375
  189.       Left            =   1320
  190.       TabIndex        =   0
  191.       Top             =   3960
  192.       Width           =   1095
  193.    End
  194.    Begin Shape Shape2 
  195.       BorderWidth     =   3
  196.       Height          =   2295
  197.       Left            =   5880
  198.       Top             =   480
  199.       Visible         =   0   'False
  200.       Width           =   1575
  201.    End
  202.    Begin Shape Shape1 
  203.       BorderWidth     =   3
  204.       Height          =   1455
  205.       Left            =   5880
  206.       Top             =   3000
  207.       Visible         =   0   'False
  208.       Width           =   1575
  209.    End
  210.    Begin Label Label1 
  211.       Alignment       =   1  'Right Justify
  212.       BackColor       =   &H00FFFFC0&
  213.       Caption         =   "Postal Code :"
  214.       Height          =   255
  215.       Index           =   8
  216.       Left            =   120
  217.       TabIndex        =   10
  218.       Top             =   3480
  219.       Visible         =   0   'False
  220.       Width           =   1215
  221.    End
  222.    Begin Label Label1 
  223.       Alignment       =   1  'Right Justify
  224.       BackColor       =   &H00FFFFC0&
  225.       Caption         =   "Country :"
  226.       Height          =   255
  227.       Index           =   7
  228.       Left            =   120
  229.       TabIndex        =   9
  230.       Top             =   3120
  231.       Visible         =   0   'False
  232.       Width           =   1215
  233.    End
  234.    Begin Label Label1 
  235.       Alignment       =   1  'Right Justify
  236.       BackColor       =   &H00FFFFC0&
  237.       Caption         =   "State :"
  238.       Height          =   255
  239.       Index           =   6
  240.       Left            =   120
  241.       TabIndex        =   8
  242.       Top             =   2760
  243.       Visible         =   0   'False
  244.       Width           =   1215
  245.    End
  246.    Begin Label Label1 
  247.       Alignment       =   1  'Right Justify
  248.       BackColor       =   &H00FFFFC0&
  249.       Caption         =   "City :"
  250.       Height          =   255
  251.       Index           =   5
  252.       Left            =   120
  253.       TabIndex        =   7
  254.       Top             =   2400
  255.       Visible         =   0   'False
  256.       Width           =   1215
  257.    End
  258.    Begin Label Label1 
  259.       Alignment       =   1  'Right Justify
  260.       BackColor       =   &H00FFFFC0&
  261.       Caption         =   "Address :"
  262.       Height          =   255
  263.       Index           =   4
  264.       Left            =   120
  265.       TabIndex        =   6
  266.       Top             =   2040
  267.       Visible         =   0   'False
  268.       Width           =   1215
  269.    End
  270.    Begin Label Label1 
  271.       Alignment       =   1  'Right Justify
  272.       BackColor       =   &H00FFFFC0&
  273.       Caption         =   "Phone # :"
  274.       Height          =   255
  275.       Index           =   3
  276.       Left            =   120
  277.       TabIndex        =   5
  278.       Top             =   1680
  279.       Visible         =   0   'False
  280.       Width           =   1215
  281.    End
  282.    Begin Label Label1 
  283.       Alignment       =   1  'Right Justify
  284.       BackColor       =   &H00FFFFC0&
  285.       Caption         =   "First Name :"
  286.       Height          =   255
  287.       Index           =   2
  288.       Left            =   120
  289.       TabIndex        =   4
  290.       Top             =   1320
  291.       Visible         =   0   'False
  292.       Width           =   1215
  293.    End
  294.    Begin Label Label1 
  295.       Alignment       =   1  'Right Justify
  296.       BackColor       =   &H00FFFFC0&
  297.       Caption         =   "Last Name :"
  298.       Height          =   255
  299.       Index           =   1
  300.       Left            =   120
  301.       TabIndex        =   3
  302.       Top             =   960
  303.       Visible         =   0   'False
  304.       Width           =   1215
  305.    End
  306.    Begin Label Label1 
  307.       Alignment       =   1  'Right Justify
  308.       BackColor       =   &H00FFFFC0&
  309.       Caption         =   "Author Id :"
  310.       Height          =   255
  311.       Index           =   0
  312.       Left            =   120
  313.       TabIndex        =   2
  314.       Top             =   600
  315.       Visible         =   0   'False
  316.       Width           =   1215
  317.    End
  318. Dim t(1 To 3) As String
  319. Sub author_list_Click ()
  320.     show_author
  321.     chgbut.Visible = True
  322.     delbut.Visible = True
  323. End Sub
  324. Sub cancelbut_Click ()
  325.     author_list.Enabled = True
  326.     If author_list.ListIndex <> -1 Then
  327.     chgbut.Visible = True
  328.     delbut.Visible = True
  329.     End If
  330.     updbut.Visible = False
  331.     newrec.Visible = True
  332.     cancelbut.Visible = False
  333.     For i = 0 To 8
  334.     text1(i).Enabled = False
  335.     Next
  336.     show_author
  337. End Sub
  338. Sub chgbut_Click ()
  339.     For i = 1 To 8
  340.        text1(i).Enabled = True
  341.     Next
  342.     author_list.Enabled = False
  343.     chgbut.Visible = False
  344.     updbut.Visible = True
  345.     newrec.Visible = False
  346.     delbut.Visible = False
  347.     cancelbut.Visible = True
  348.     updflag = 1
  349.     text1(1).SetFocus
  350. End Sub
  351.     Sub delbut_Click ()
  352.     updflag = 3
  353.     updbut.Visible = True
  354.     chgbut.Visible = False
  355.     newrec.Visible = False
  356.     cancelbut.Visible = True
  357.     delbut.Visible = False
  358.     author_list.Enabled = False
  359. End Sub
  360. Sub exitbut_Click ()
  361.     If dbconn <> 0 Then
  362.     SqlClose (dbconn)
  363.     End If
  364.     sqlwinexit
  365.     sqlexit
  366.     End
  367. End Sub
  368. Sub Form_Load ()
  369.     updflag = 0
  370. End Sub
  371. Sub multibut_Click ()
  372.     logon.Show 1
  373.     If multibut.Visible = True Then
  374.     Exit Sub
  375.     End If
  376.     newrec.Visible = True
  377. '   Once the user has logged on to the server the list box will be
  378. '   populated with a list of the Author Id, Last Name, and First Name
  379. '   The first function is to place the SQL Statement required to get
  380. '   this information from the server into the command buffer using
  381. '   the SqlCmd function
  382.     ret = SqlCmd(dbconn, "select 'Author Id' = au_id , 'Last Name' = au_lname , 'First Name' = au_fname  from authors")
  383.     If ret = 1 Then
  384. '   The SqlExec function is then used to send the SQL Statement to the
  385. '   server for execution. It is at this point that syntax checking is
  386. '   performed
  387.     ret = SqlExec(dbconn)
  388.     If ret = 1 Then
  389.         
  390. '   If the command syntax was correct the command will be executing at
  391. '   the server now. The next function is the SqlResults function. This
  392. '   function will return once the processing is complete on the server.
  393. '   If the SqlCmd function had been passed more than one SQL command then
  394. '   you must perform a SqlResults for each result set being sent back.
  395. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  396. '   from SqlResults
  397.         ret = SqlResults(dbconn)
  398.         If ret = 1 Then
  399. '   Once the SqlResults returns with the indication that a result set
  400. '   is available we can get the number of columns in the result set. In
  401. '   this application this function is not required since we know how
  402. '   many columns were requested. If the application allowed for AdHoc
  403. '   SQL requests then this function is used to indicate the number of
  404. '   columns of data available.
  405.         cols% = SqlNumCols(dbconn)
  406. '   To get the column headings we use the SqlColName function. This function
  407. '   will return either the column name based on the internal column name or
  408. '   if the syntax 'Column Name' = colname is used to override the internal
  409. '   column name. In our example we have chosen to override the column name
  410.         For c% = 1 To cols%
  411.             colnam$ = SqlColName(dbconn, c%)
  412.         Next
  413. '   Once the result set is available for processing each row needs to be
  414. '   retrieved. This is accomplished by calling SqlNextRow until the function
  415. '   returns NOMOREROWS(-2)
  416.         ret = SqlNextRow(dbconn)
  417.         While ret <> NOMOREROWS
  418. '   For each column in the result set we call the function SqlData to
  419. '   get the data returned for the column. The data returned is a string
  420. '   representation of the data in the result column. The data is right
  421. '   trimmed when returned. The data when return is being concatonated
  422. '   with tabs (chr(9)) between each item to populate the drop down list
  423. '   box with three columns
  424.             
  425.             For c% = 1 To cols%
  426.             t(c%) = SqlData(dbconn, c%)
  427.             Next
  428.             aitem$ = t(1) & Space(15 - Len(t(1))) & Left(t(2) & Space(41 - Len(t(2))), 20) & t(3)
  429.             author_list.AddItem aitem$
  430.             ret = SqlNextRow(dbconn)
  431.         Wend
  432.         End If
  433.     End If
  434.     End If
  435.     If ret <> NOMOREROWS Then
  436.     Exit Sub
  437.     End If
  438.     For i = 0 To 8
  439.     label1(i).Visible = True
  440.     text1(i).Visible = True
  441.     Next
  442.     author_list.Visible = True
  443.     newrec.Visible = True
  444.     shape1.Visible = True
  445.     shape2.Visible = True
  446. End Sub
  447. Sub newrec_Click ()
  448.     updflag = 2
  449.     updbut.Visible = True
  450.     chgbut.Visible = False
  451.     newrec.Visible = False
  452.     cancelbut.Visible = True
  453.     delbut.Visible = False
  454.     author_list.Enabled = False
  455.     For i = 0 To 8
  456.     text1(i).Enabled = True
  457.     text1(i).Text = ""
  458.     Next
  459.     text1(0).SetFocus
  460. End Sub
  461. Function process_no_rows () As Integer
  462. '   If the SQL Statement was successfully placed into the command buffer then
  463. '   send the command to the server for execution.
  464.     ret = SqlExec(dbconn)
  465.     If ret = 1 Then
  466. '   The SqlResults function will wait until the function is complete on
  467. '   the server. A return of 1 indicates that the statement has been executed
  468. '   on the server
  469.     ret = SqlResults(dbconn)
  470.     If ret = 1 Then
  471. '   In the case of a delete there are no rows returned in the result set
  472. '   the SqlRows command will confirm that no rows were returned.
  473.         ret = SqlRows(dbconn)
  474.         If ret = 1 Then
  475.         MsgBox "This command should not return rows"
  476.         Else
  477.         If updflag = 1 Then
  478.             MsgBox "Information changed for au_id " & text1(0).Text
  479.         Else
  480.             If updflag = 2 Then
  481.             MsgBox "Information added for au_id " & text1(0).Text
  482.             Else
  483.             MsgBox "Information deleted for au_id " & text1(0).Text
  484.             End If
  485.         End If
  486.         End If
  487.     Else
  488.         process_no_rows = ret
  489.         Exit Function
  490.     End If
  491.     Else
  492.     process_no_rows = ret
  493.     End If
  494.     process_no_rows = 99
  495. End Function
  496. Sub show_author ()
  497.     lc = author_list.ListIndex
  498.     If lc = -1 Then
  499.     Exit Sub
  500.     End If
  501.     d$ = RTrim(Left(author_list.List(lc), 15))
  502. '   Once the author has been selected from the list of authors
  503. '   process a SQL Statement which will select all the fields
  504. '   from the authors table for the author selected from the list
  505. '   by using the where clause on the primary key of the table
  506. '   The checking the ret variable for 1 indicates a test for a
  507. '   success. If the ret variable contains a 0 then the function
  508. '   failed
  509.     ret = SqlCmd(dbconn, "select * from authors where au_id = " & Chr(34) & d$ & Chr$(34))
  510.     If ret = 1 Then
  511. '   If the command was accepted into the buffer in the statement above
  512. '   then send it to the server for execution. If there are syntax
  513. '   errors in the statement then they will be found in the SqlExec step
  514.     ret = SqlExec(dbconn)
  515.     If ret = 1 Then
  516. '   If the command syntax was correct the command will be executing at
  517. '   the server now. The next function is the SqlResults function. This
  518. '   function will return once the processing is complete on the server.
  519. '   If the SqlCmd function had been passed more than one SQL command then
  520. '   you must perform a SqlResults for each result set being sent back.
  521. '   The end of result sets will be indicated by a NOMORERESUTLS(2) return
  522. '   from SqlResults
  523.         ret = SqlResults(dbconn)
  524.         If ret = 1 Then
  525. '   Once the result set is available for processing each row needs to be
  526. '   retrieved. This is accomplished by calling SqlNextRow until the function
  527. '   returns NOMOREROWS(-2)
  528.         ret = SqlNextRow(dbconn)
  529.         While ret <> NOMOREROWS
  530. '   For each column in the result set we call the function SqlData to
  531. '   get the data returned for the column. The data returned is a string
  532. '   representation of the data in the result column. The data is right
  533. '   trimmed when returned.
  534.             For c% = 1 To 9
  535.             dat$ = SqlData(dbconn, c%)
  536.             text1(c% - 1).Text = dat$
  537.             Next
  538.             ret = SqlNextRow(dbconn)
  539.         Wend
  540.         End If
  541.     End If
  542.     End If
  543. End Sub
  544. Sub SQLVBXDB1_ERROR (Sqlconn As Integer, Severity As Integer, ErrorNum As Integer, OsError As Integer, ErrorStr As String, OsErrorStr As String, RetCode As Integer)
  545. '   This is a SQL Server callback routine
  546. '   When the server needs to inform the user of a error this callback is
  547. '   called. For example if the user tries to logon to a server which does
  548. '   not exist then the error message string (errorstr) will contain text
  549. '   indicating that a connection with the requested server cannot be made.
  550. '   It is also this routine which is called when syntax errors are discovered
  551. '   in SQL commands submitted for execution.
  552.     MsgBox ErrorStr
  553. End Sub
  554. Sub SQLVBXDB1_MESSAGE (Sqlconn As Integer, Message As Long, State As Integer, Severity As Integer, msgstr As String, ServerName As String, ProcName As String, LineNum As Integer)
  555. '   This is a SQL Server callback routine
  556. '   When the server needs to inform the user of a status change this callback is
  557. '   used. For example when the user changes databases using the SqlUse function
  558. '   this event procedure will be called and the message string (msgstr) will
  559. '   contain text indicating the new database name.
  560. '   The variable severity can be used to filter the messages so that only messages
  561. '   which need to be seen can be displayed to the user
  562.     MsgBox msgstr
  563. End Sub
  564. Sub Text1_KeyPress (index As Integer, keyascii As Integer)
  565.     If updflag = 0 Then
  566.     keyascii = 0
  567.     End If
  568. End Sub
  569. Sub updbut_Click ()
  570.     Dim sql As String
  571.     If updflag = 3 Then
  572.     GoTo dontcheck
  573.     End If
  574.     If text1(0).Text = "" Then
  575.     MsgBox "Author Id cannot be NULL"
  576.     Exit Sub
  577.     End If
  578.     If text1(1).Text = "" Then
  579.     MsgBox "Last name cannot be NULL"
  580.     Exit Sub
  581.     End If
  582.     If text1(2).Text = "" Then
  583.     MsgBox "First name cannot be NULL"
  584.     Exit Sub
  585.     End If
  586.     If text1(3).Text = "" Then
  587.     MsgBox "Phone # cannot be NULL"
  588.     Exit Sub
  589.     End If
  590. dontcheck:
  591.     If updflag = 1 Then
  592. '   In this application if the updflag is set to 1 then we are modifing the
  593. '   data for a particular row in the table authors. The following code will
  594. '   create a SQL Statement to 'UPDATE' the authors table where the au_id field
  595. '   is equal to the requested author id.
  596.     sql = "update authors set "
  597.     sql = sql & " au_lname = " & Chr(34) & text1(1).Text & Chr(34) & " ,"
  598.     sql = sql & " au_fname = " & Chr(34) & text1(2).Text & Chr(34) & " ,"
  599.     sql = sql & " phone = " & Chr(34) & text1(3).Text & Chr(34) & " ,"
  600.     sql = sql & " address = " & Chr(34) & text1(4).Text & Chr(34) & " ,"
  601.     sql = sql & " city = " & Chr(34) & text1(5).Text & Chr(34) & " ,"
  602.     sql = sql & " state = " & Chr(34) & text1(6).Text & Chr(34) & " ,"
  603.     sql = sql & " country = " & Chr(34) & text1(7).Text & Chr(34) & " ,"
  604.     sql = sql & " postalcode = " & Chr(34) & text1(8).Text & Chr(34)
  605.     sql = sql & " where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  606.     Else
  607.     If updflag = 2 Then
  608. '   In this application if the updflag is set to 2 then we are adding
  609. '   data for a particular row in the table authors. The following code will
  610. '   create a SQL Statement to 'INSERT' a row into the authors table where the
  611. '   au_id field is equal to the requested author id.
  612.     sql = "insert authors values ("
  613.     For i = 0 To 7
  614.         sql = sql & Chr(34) & text1(i).Text & Chr(34) & " , "
  615.     Next
  616.     sql = sql & "convert(bit," & Chr(34) & text1(8).Text & Chr(34) & "))"
  617.       Else
  618. '   In this application if the updflag is set to 3 then we are deleting
  619. '   an author record from the table
  620. '   The SQL statement will delete a row from the table based on the
  621. '   primary key (au_id)
  622.         sql = "delete from authors where au_id = " & Chr(34) & text1(0).Text & Chr(34)
  623.     End If
  624.     End If
  625.     ret = SqlCmd(dbconn, sql)
  626.     If ret = 1 Then
  627. '   If the command was successfully placed in the command buffer then call
  628. '   the subroutine to process a SQL Statement with no rows being returned
  629.     ret = process_no_rows()
  630.     End If
  631.     If ret = 99 Then
  632.     If updflag = 2 Then
  633.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  634.         author_list.AddItem aitem$
  635.         author_list.ListIndex = author_list.ListCount - 1
  636.     Else
  637.         If updflag = 1 Then
  638.         aitem$ = text1(0).Text & Space(15 - Len(text1(0).Text)) & Left(text1(1).Text & Space(41 - Len(text1(1).Text)), 20) & text1(2).Text
  639.         lc = author_list.ListIndex
  640.         author_list.List(lc) = aitem$
  641.         Else
  642.         lc = author_list.ListIndex
  643.         author_list.RemoveItem lc
  644.         author_list.ListIndex = 0
  645.         End If
  646.     End If
  647.     End If
  648.     author_list.Enabled = True
  649.     chgbut.Visible = True
  650.     updbut.Visible = False
  651.     newrec.Visible = True
  652.     cancelbut.Visible = False
  653.     delbut.Visible = True
  654.     For i = 0 To 8
  655.     text1(i).Enabled = False
  656.     Next
  657. End Sub
  658.